package com.yintao.ytframe.base.design.abfactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

import java.util.concurrent.ConcurrentHashMap;

/**
 * 公用方法类，所有的地方都在调用这个方法
 */
public class AbRedisUtils {

    private static final Logger log = LoggerFactory.getLogger(AbRedisUtils.class);

    private static ConcurrentHashMap<String, String> dataMap = new ConcurrentHashMap<>();

    public static String get(String key) {
        log.info("AbRedisUtils --> get info,key = [{}]", key);
        if (StringUtils.isEmpty(key)) {
            return null;
        }
        return dataMap.get(key);
    }

    public static void put(String key, String value) {
        log.info("AbRedisUtils --> put info,key = [{}], value = [{}]", key, value);
        if (StringUtils.isEmpty(key)) {
            return;
        }
        dataMap.put(key, value);
    }

}
